#pragma warning(disable : 4819)
#pragma once
#include <cmath>
#include <memory>
#include <list>
#include <SDL.h>

struct Tank;
struct Bullet;
struct PlayerTank;

//地图大小 13x13个block
#define MAP_WIDTH 13
#define MAP_HEIGHT 13

//每块地图块的大小
#define MAP_BLOCK_WIDTH 60
#define MAP_BLOCK_HEIGHT 60

//砖块的最小单位15x15,子弹的最小单位也是15x15
#define MAP_BLOCK_PIECE_SIZE 15
#define BULLET_SIZE 15
//地形枚举
enum TerrainType
{
    Empty,          //空
    ICE,            //冰
    Junjle,         //森林
    Water,          //水
    Iron,           //铁
    Brick,          //砖
    TerrainTypeNum
};

//方向
enum Angle
{
    UP,
    RIGHT,
    DOWN,
    LEFT
};

enum EnemyType
{
    Common,
    Fast,
    Power,
    Heavy
};

class GameScene;

//地形块
struct Terrain
{
    TerrainType type = TerrainType::Empty;
    uint16_t block_bit = 0xFFFF; //每个Terrain都分为16个block,0表示空，1表示实。用于碰撞检测
    bool CanDesory(const std::shared_ptr<Bullet> bullet);
    //判断是否可以移动
    bool CanMove();
};

//移动对象
class MoveObject
{
public:
    float x_;
    float y_;
    int width_;
    int height_;
    Angle angle_;
    float speed_;
    bool isAlive_ = true;
public:
    MoveObject() = default;
    MoveObject(float x,float y,int width,int height,Angle angle,float speed);
    virtual ~MoveObject() = default;
    virtual void Move(float dt) {};
    inline SDL_Rect GetRect()const {return {static_cast<int>(x_),static_cast<int>(y_),width_,height_};}
};

